package cn.alcatraz.controller;

import cn.alcatraz.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
* @Description: TODO
* @Author: Alcatraz
* @Version: 1.0
* @Date:  2022/7/27 21:18
*/

@RestController
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable Long id){
        String url = "http://localhost:1020/getUserById/" + id;
        return restTemplate.getForObject(url, User.class);
    }
}
